package com.bwie.parkdemo.adapter;

import android.graphics.Color;
import android.support.annotation.NonNull;
import android.widget.TextView;

import com.bwie.parkdemo.R;
import com.bwie.parkdemo.mvvm.model.entity.HistorySignEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

public class HistorySignAdapter extends BaseQuickAdapter<Object,BaseViewHolder> {
    public HistorySignAdapter() {
        super(R.layout.item_history_sign);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Object item) {
        HistorySignEntity.Values values = (HistorySignEntity.Values) item;
        TextView nameTv = helper.getView(R.id.history_item_userName);
        TextView startTime = helper.getView(R.id.history_item_startTime);
        TextView endTime = helper.getView(R.id.history_item_endTime);
        TextView startAddress = helper.getView(R.id.history_item_startAddress);
        TextView endAddress = helper.getView(R.id.history_item_endAddress);
        if (values.flag) {
            nameTv.setBackgroundColor(Color.parseColor("#c1c1c1"));
            startTime.setBackgroundColor(Color.parseColor("#c1c1c1"));
            endTime.setBackgroundColor(Color.parseColor("#c1c1c1"));
            startAddress.setBackgroundColor(Color.parseColor("#c1c1c1"));
            endAddress.setBackgroundColor(Color.parseColor("#c1c1c1"));
            nameTv.setText("员工姓名");
            startTime.setText("开始时间");
            endTime.setText("结束时间");
            startAddress.setText("签到地址");
            endAddress.setText("签退地址");
            return;
        }
        nameTv.setBackgroundColor(Color.WHITE);
        startTime.setBackgroundColor(Color.WHITE);
        endTime.setBackgroundColor(Color.WHITE);
        startAddress.setBackgroundColor(Color.WHITE);
        endAddress.setBackgroundColor(Color.WHITE);
        nameTv.setText("uID:"+values.userId);
        startTime.setText(values.startTime);
        endTime.setText(values.endTime);
        startAddress.setText(values.startAddress);
        endAddress.setText(values.endAddress);
    }
}
